package javas.net;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;

public class TestMulticastSocketReceive {
	private static int PORT = 10000;
	
	public static void main(String[] args) throws IOException {
		InetAddress group = InetAddress.getByName( "228.5.6.7");
		MulticastSocket socket = new MulticastSocket(PORT);
		socket.setTimeToLive(244); //���㲥�׽��ַ�����ݱ���ΧΪ�������硣 
        socket.joinGroup(group);
        
        byte[] data = new byte[1024];
        DatagramPacket hi = new DatagramPacket(data, data.length, group, PORT);
        socket.receive(hi);
        System.out.println(new String(data));
        
        socket.close();
	}

}
